<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.List"%>
<%@ page import="cn.com.pet.common.entity.PetType"%>
<%@ page import="cn.com.pet.common.entity.Pet"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

	<%
		List<PetType> allPetTypeByParentId = //
		(List<PetType>) session.getValue("PetType");
		if (null == allPetTypeByParentId) {
			response.sendRedirect(basePath + "action/petInfoIndex.do");
		} else {
			int count = allPetTypeByParentId.size();
			for (int i = 0; i < count; i++) {
				out.println("<a href=\"" + basePath
						+ "action/getPetInfo.do?id="
						+ allPetTypeByParentId.get(i).getPetTypeId()
						+ "\">"
						+ allPetTypeByParentId.get(i).getPetTypeName()
						+ "</a>");
				out.println("<br /><br />");

				int size = allPetTypeByParentId.get(i).getPetList().size();
				int nameLength = 0;
				for (int j = 0; j < size; j++) {
					Pet tempPet = // 
					allPetTypeByParentId.get(i).getPetList().get(j);

					if ((nameLength + tempPet.getPetName().length()) > 10) {
						out.println("<br />");
						nameLength = 0 + tempPet.getPetName().length();
					} else {
						nameLength += tempPet.getPetName().length();
					}

					out.println("&nbsp;&nbsp;<a href=\"" + basePath
							+ "action/getPetInfo.do?id="
							+ tempPet.getPetId() + "\">"
							+ tempPet.getPetName() + "</a>");
				}
			}

		}
	%>
</body>
</html>